package com.party.core.service.member.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.member.UserLogoutLogReadDao;
import com.party.core.dao.write.member.UserLogoutLogWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.member.UserLogoutLog;
import com.party.core.service.member.IUserLogoutLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Set;
@Service
public class UserLogoutLogService implements IUserLogoutLogService {
    @Autowired
    private UserLogoutLogWriteDao userLogoutLogWriteDao;
    @Autowired
    private UserLogoutLogReadDao userLogoutLogReadDao;

    @Override
    public String insert(UserLogoutLog userLogoutLog) {
        BaseModel.preInsert(userLogoutLog);
        boolean result = userLogoutLogWriteDao.insert(userLogoutLog);
        if (result){
            return userLogoutLog.getId();
        }
        return null;
    }

    @Override
    public boolean update(UserLogoutLog userLogoutLog) {
        userLogoutLog.setUpdateDate(new Date());
        return userLogoutLogWriteDao.update(userLogoutLog);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        return userLogoutLogWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public UserLogoutLog get(String id) {
        return userLogoutLogReadDao.get(id);
    }

    @Override
    public List<UserLogoutLog> listPage(UserLogoutLog userLogoutLog, Page page) {
        return userLogoutLogReadDao.listPage(userLogoutLog,page);
    }

    @Override
    public List<UserLogoutLog> list(UserLogoutLog userLogoutLog) {
        return userLogoutLogReadDao.listPage(userLogoutLog,null);
    }

    @Override
    public List<UserLogoutLog> batchList(Set<String> ids, UserLogoutLog userLogoutLog, Page page) {
        return null;
    }

    @Override
    public UserLogoutLog getByUserId(String userId) {
        return userLogoutLogReadDao.getByUserId(userId);
    }
}
